package week_home_work02;

import java.util.Scanner;

/**
 * @author zdl
 * @date 2024/11/22
 */
public class Demo7 {
    public static void main(String[] args) {
        //输入一个数字，输出它的阶乘。
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个整数:");
        int num = sc.nextInt();
        if (num <= 0) {
            System.out.println("输入有误，退出程序！");
            System.exit(0);
        }
        int x = 1;
        for (int i = 1; i <= num; i++) {
            x *= i;

        }
        System.out.println(x);
    }
}
